// Playground - noun: a place where people can play

import Cocoa


/*********************************************************************
 * The Swift Language Learning  Chapter 19: Generics
 *********************************************************************/

func swapTwoValues<T>(inout a:T, inout b:T) {
	let temp = a
	a = b
	b = temp
}

var someString = "hello"
var anotherString = "world"

swapTwoValues(&someString, &anotherString)

someString
anotherString

struct Stack<T> {
	
	var items = T[]()
	
	mutating func push(item:T) {
		items += item
	}
	
	mutating func pop() -> T {
		return items.removeLast()
	}
	
}

var stackOfStrings = Stack<String>()
stackOfStrings.push("uno")
stackOfStrings.push("dos")
stackOfStrings.push("tres")
stackOfStrings.push("cuatro")

stackOfStrings



/*********************************************************************
* The Swift Language Learning  Chapter 20: Advanced Operators
*********************************************************************/

var willOverflow = UInt8.max
willOverflow = willOverflow &+ 1 //prevent overflow


let x = 1
let y = 1 &/ 0


//overloading operator
//@assignmet @prefix @postfix @infix








